package com.yanqu.road.server.pb;

import com.yanqu.road.entity.player.UserSubscribe;
import com.yanqu.road.pb.subscribe.SubscribeProto;
import java.util.List;

public class SubscribePb {
    public static SubscribeProto.SubscribeTempMsg.Builder parseSubscribeTempMsg(UserSubscribe data){
        if(null == data){
            return null;
        }
        SubscribeProto.SubscribeTempMsg.Builder msg = SubscribeProto.SubscribeTempMsg.newBuilder();
        msg.setMallId(data.getMallId());
        msg.setType(data.getType());
        msg.setExpiresTime(data.getExpiresTime());
        return msg;
    }

    public static SubscribeProto.SubscribeListMsg.Builder parseSubscribeListMsg(List<UserSubscribe> dataList){
        SubscribeProto.SubscribeListMsg.Builder listMsg = SubscribeProto.SubscribeListMsg.newBuilder();
        if(null != dataList){
            for(UserSubscribe data : dataList){
                SubscribeProto.SubscribeTempMsg.Builder msg = parseSubscribeTempMsg(data);
                if(null != msg){
                    listMsg.addDataList(msg);
                }
            }
        }
        return listMsg;
    }
}
